#include "imgui/custom/Modal.h"

using namespace ImGui;

void Modal::ViewFunc()
{
}

void Modal::HandleFunc()
{
}
void ImGui::Modal::Handle()
{
	HandleFunc();
}

void ImGui::Modal::Inst()
{
	if (m_Open)
	{
		ImGui::OpenPopup(m_Title.c_str());

		if (ImGui::BeginPopupModal(m_Title.c_str(), &m_Open, m_Flag))
		{
			m_IsFocused = ImGui::IsWindowFocused();
			m_IsHovered = ImGui::IsWindowHovered();

			ViewFunc();
			ImGui::EndPopup();
		}
	}

}

void ImGui::Modal::Open()
{
	m_Open = true;
}

void ImGui::Modal::Close()
{
	m_Open = false;
}

Modal::Modal(const std::string& title, ImGuiWindowFlags flag)
	:m_Title(title), m_Flag(flag)
{
}
